package com.jptomato.android.demo.provider;

import com.jptomato.android.demo.sqlite.ddl.SqliteTableBuilder;

import android.net.Uri;
import android.provider.BaseColumns;

public interface AppsDatabase {
	public static final int DATABASE_VERSION = 1;
	public static final String DATABASE_NAME = "db";
	public static final String AUTHORITY = "com.jptomato.android.demo.provider.AppsDatabase";
	public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/");

	public final static class CategoryTable extends SqliteTableBuilder {
		static final String DIR_TYPE = "vnd.android.cursor.dir/vnd.reco.CategoryTable";
		static final String ITEM_TYPE = "vnd.android.cursor.item/vnd.reco.CategoryTable";
		static final String NAME = "CategoryTable";

		public static final Uri CONTENT_URI = Uri.withAppendedPath(AppsDatabase.BASE_CONTENT_URI, NAME);

		public CategoryTable() {
			super(NAME);
			//
			addIntegerColumn(Columns._ID, CONSTRAINT_PRIMARY_KEY_AUTOINCREMENT_NOT_NULL);
			addTextColumn(Columns.NAME, CONSTRAINT_NOT_NULL);
			addIntegerColumn(Columns.INDEX);
		}

		public static interface Columns extends BaseColumns {
			/**
			 * カテゴリ名 <br>
			 * type:Text
			 */
			public static final String NAME = "name";
			/**
			 * 並び替えの順番 <br>
			 * type:Integer
			 */
			public static final String INDEX = "index";
		}
	}

	public final static class AppsTable extends SqliteTableBuilder {
		static final String DIR_TYPE = "vnd.android.cursor.dir/vnd.reco.AppsTable";
		static final String ITEM_TYPE = "vnd.android.cursor.item/vnd.reco.AppsTable";
		static final String NAME = "AppsTable";

		public static final Uri CONTENT_URI = Uri.withAppendedPath(AppsDatabase.BASE_CONTENT_URI, NAME);

		public AppsTable() {
			super(NAME);
			//
			addIntegerColumn(Columns._ID, CONSTRAINT_PRIMARY_KEY_AUTOINCREMENT_NOT_NULL);
			addTextColumn(Columns.NAME, CONSTRAINT_NOT_NULL);
			addTextColumn(Columns.PACKAGE, CONSTRAINT_NOT_NULL);
		}

		public static interface Columns extends BaseColumns {
			/**
			 * アプリ名 <br>
			 * type:Text
			 */
			public static final String NAME = "name";
			/**
			 * アプリのパーケージ名 <br>
			 * type:Text
			 */
			public static final String PACKAGE = "package";
		}
	}
}
